<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>切换到当前目录的父目录</title>
 </head>
 <body class="docs"><div id="layout">
  <div id="layout-content"><div id="function.ftp-cdup" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">ftp_cdup</h1>
  <p class="verinfo">(PHP 4, PHP 5, PHP 7)</p><p class="refpurpose"><span class="refname">ftp_cdup</span> &mdash; <span class="dc-title">切换到当前目录的父目录</span></p>

 </div>
 <div class="refsect1 description" id="refsect1-function.ftp-cdup-description">
  <h3 class="title">说明</h3>
  <div class="methodsynopsis dc-description">
   <span class="methodname"><strong>ftp_cdup</strong></span>
    ( <span class="methodparam"><span class="type">resource</span> <code class="parameter">$ftp_stream</code></span>
   ) : <span class="type">bool</span></div>

  <p class="para rdfs-comment">
   切换目录至当前目录的父目录 (上级目录)。
  </p>
 </div>

 <div class="refsect1 parameters" id="refsect1-function.ftp-cdup-parameters">
  <h3 class="title">参数</h3>
  <p class="para">
   <dl>

    
     <dt>
<code class="parameter">ftp_stream</code></dt>

     <dd>

      <p class="para">
       FTP 连接的标识符。
      </p>
     </dd>

    
   </dl>

  </p>
 </div>

 <div class="refsect1 returnvalues" id="refsect1-function.ftp-cdup-returnvalues">
  <h3 class="title">返回值</h3>
  <p class="para">
   成功时返回 <strong><code>TRUE</code></strong>， 或者在失败时返回 <strong><code>FALSE</code></strong>。
  </p>
 </div>
 
 <div class="refsect1 examples" id="refsect1-function.ftp-cdup-examples"> 
  <h3 class="title">范例</h3> 
  <p class="para"> 
   <div class="example" id="example-5304"> 
    <p><strong>Example #1 <span class="function"><strong>ftp_cdup()</strong></span> 例子</strong></p> 
    <div class="example-contents"> 
<div class="phpcode"><pre><span style="color: #000000">
<span style="color: #0000BB">&lt;?php&nbsp;<br /></span><span style="color: #FF8000">//&nbsp;set&nbsp;up&nbsp;basic&nbsp;connection&nbsp;<br /></span><span style="color: #0000BB">$conn_id&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">ftp_connect</span><span style="color: #007700">(</span><span style="color: #0000BB">$ftp_server</span><span style="color: #007700">);&nbsp;<br /><br /></span><span style="color: #FF8000">//&nbsp;login&nbsp;with&nbsp;username&nbsp;and&nbsp;password&nbsp;<br /></span><span style="color: #0000BB">$login_result&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">ftp_login</span><span style="color: #007700">(</span><span style="color: #0000BB">$conn_id</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">$ftp_user_name</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">$ftp_user_pass</span><span style="color: #007700">);&nbsp;<br /><br /></span><span style="color: #FF8000">//&nbsp;change&nbsp;the&nbsp;current&nbsp;directory&nbsp;to&nbsp;html&nbsp;<br /></span><span style="color: #0000BB">ftp_chdir</span><span style="color: #007700">(</span><span style="color: #0000BB">$conn_id</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">'html'</span><span style="color: #007700">);&nbsp;<br /><br />echo&nbsp;</span><span style="color: #0000BB">ftp_pwd</span><span style="color: #007700">(</span><span style="color: #0000BB">$conn_id</span><span style="color: #007700">);&nbsp;</span><span style="color: #FF8000">//&nbsp;/html&nbsp;<br /><br />//&nbsp;return&nbsp;to&nbsp;the&nbsp;parent&nbsp;directory&nbsp;<br /></span><span style="color: #007700">if&nbsp;(</span><span style="color: #0000BB">ftp_cdup</span><span style="color: #007700">(</span><span style="color: #0000BB">$conn_id</span><span style="color: #007700">))&nbsp;{&nbsp;<br />&nbsp;&nbsp;echo&nbsp;</span><span style="color: #DD0000">"cdup&nbsp;successful\n"</span><span style="color: #007700">;&nbsp;<br />}&nbsp;else&nbsp;{&nbsp;<br />&nbsp;&nbsp;echo&nbsp;</span><span style="color: #DD0000">"cdup&nbsp;not&nbsp;successful\n"</span><span style="color: #007700">;&nbsp;<br />}&nbsp;<br /><br />echo&nbsp;</span><span style="color: #0000BB">ftp_pwd</span><span style="color: #007700">(</span><span style="color: #0000BB">$conn_id</span><span style="color: #007700">);&nbsp;</span><span style="color: #FF8000">//&nbsp;/&nbsp;<br /><br /></span><span style="color: #0000BB">ftp_close</span><span style="color: #007700">(</span><span style="color: #0000BB">$conn_id</span><span style="color: #007700">);&nbsp;<br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</pre></div> 
    </div>
 
   </div> 
  </p> 
 </div>
 
 <div class="refsect1 seealso" id="refsect1-function.ftp-cdup-seealso"> 
  <h3 class="title">参见</h3> 
  <p class="para">
   <ul class="simplelist">
    <li class="member"><span class="function"><a href="ftp_chdir.html" class="function" rel="rdfs-seeAlso">ftp_chdir()</a> - 在 FTP 服务器上改变当前目录</span></li>
    <li class="member"><span class="function"><a href="ftp_pwd.html" class="function" rel="rdfs-seeAlso">ftp_pwd()</a> - 返回当前目录名</span></li>
   </ul>
  </p>
 </div>

</div></div></div></body></html>